#include "vector/relu_test.h"

#include "log.h"
#include "vector/relu.h"

void ReLUTest::test()
{
    ReLU relu{};
    std::vector<double> input{-0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5};
    std::vector<double> output{};
    relu.forward(input, output);
    LogInfo() << "input: " << input;
    LogInfo() << "output: " << output;

    auto derivative = relu.backward();
    LogInfo() << "derivative: " << derivative;

    // 批处理测试
    auto samples = std::vector<std::vector<double>>(2, input);
    std::vector<std::vector<double>> outputs{};
    relu.forward(samples, outputs);
    LogInfo() << "samples: " << samples;
    LogInfo() << "outputs: " << outputs;
}